<?php

namespace addons\booking\controller;

use addons\booking\model\Order;

class Wifi extends Base
{
    protected $noNeedLogin = [];

    /**
     * WIFI列表
     */
    public function wifiList()
    {
        $order = Order::field('h.id,GROUP_CONCAT(w.name,",",w.password) wifi')
            ->alias('o')
            ->join('booking_house h', 'h.id=o.source_id')
            ->join('booking_wifi w', "FIND_IN_SET(w.id,h.wifi_ids)", 'LEFT')
            ->where('o.type', 0)
            ->where("o.user_id", $this->auth->id)
            ->where('o.status', 'checkined')
            ->group('o.id')
            ->find();
        $this->success('', $order);
    }
}
